package com.kuang.springcloud.controller;

import com.kuang.springcloud.pojo.Dept;
import com.kuang.springcloud.service.DeptClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import java.util.List;

@RestController
public class DeptConsumerController {

    @Autowired()
    private DeptClientService clientService;

    @RequestMapping("/consumer/dept/get/{no}")
    public Dept QueryByNo(@PathVariable("no") Long no){
        return this.clientService.QueryByNo(no);
    }

    @RequestMapping("/consumer/dept/add")
    public boolean addDept(Dept dept){
        return this.clientService.addDept(dept);
    }

    @RequestMapping("/consumer/dept/list")
    public List<Dept> QueryAll(){
       return this.clientService.QueryAll();
    }
}
